package com.ncmmall.domain.business.goods.subject;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ncmmall.domain.business.goods.Goods;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 商品专题
 *
 * @author likaikai
 * @date 2019-07-16 15:31
 */
@Entity
@Table(name = "mall_goods_subject")
@Access(AccessType.FIELD)
@Getter
@Setter
public class GoodsSubject {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    /**
     * 商品
     */
    @OneToOne
    private Goods goods;

    /**
     * 排序值
     */
    private int rank = 50;

    /**
     * 所属专题
     */
    @ManyToOne
    @JsonIgnore
    @JoinColumn(name = "subjectId")
    private Subject subject;

    /**
     * 0、用户商城端
     * 1、商家采购端
     */
    private int platformType;

}
